package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.TaskDocumentDao;
import cn.topevery.garden.entity.po.TaskDocument;
import cn.topevery.garden.entity.query.TaskDocumentQuery;
import cn.topevery.garden.entity.vo.TaskDocumentVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 内业检查
 */
@Service
public class TaskDocumentLogic extends BaseLogic<TaskDocument> {
    @Autowired
    TaskDocumentDao taskDocumentDao;

    @Override
    public BaseEntityDao<TaskDocument, Integer> getDao() {
        return taskDocumentDao;
    }


    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<TaskDocumentVO> listPage(TaskDocumentQuery query) {
        return taskDocumentDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId, Integer[] ids) {
        taskDocumentDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param taskDocument 实体
     */
    public void saveOrUpdate(String userId, TaskDocument taskDocument) {

        taskDocumentDao.saveOrUpdate(userId, taskDocument);
    }

    /**
     * 根据自定义列值来获取对象
     */
    public TaskDocument getEntityByColumn(String key, String value) {
        return taskDocumentDao.getEntityByColumn(key, value);
    }

    public DataPager<TaskDocumentVO> pageMyTask(TaskDocumentQuery query) {
        return taskDocumentDao.pageMyTask(query);
    }

}
